/*
 * AGENT SHERPA
 *  
 * Assignement 2 of the Agent Oriented Software Engineering Course
 * M.Sc. in Advanced Software Engineering (Part-time)
 * University College Dublin www.ucd.ie
 *
 * Copyright (c) 2007 Chris Walsh, Aidan Morrisy and Iain Hull.
 * All rights reserved.
 */

package org.agentsherpa;

import com.agentfactory.platform.interfaces.Actuator;
import com.agentfactory.platform.logic.FOS;

public class DroneMergeMapMessageActuator extends Actuator {
    public boolean act(FOS action) {
    	try {
    		LocationModule module = getLocationModule();
            String data = action.argAt(0).toString();
            
            module.mapMerge(MapUtil.stripQuotes(data));
    	}
    	catch (ActuatorException e) {
    		e.printStackTrace();
			return false;
		}
        return true;
    }

    private LocationModule getLocationModule() throws ActuatorException {
    	LocationModule module = (LocationModule) getModuleByName("location");
        if (module == null) {
            throw new ActuatorException("Cannot access LocationModule");
        }
        return module;
    }
}
